package Demo1;

/*
public class Solution {
    public void merge(int[] nums1, int m, int[] nums2, int n) {
        int[] sumNums = new int[m + n];

        int mIndex = 0;
        int nIndex = 0;
        int sumNumsIndex = 0;
        while (m != 0 && n != 0){
            if (nums1[mIndex] > nums2[nIndex]){
                sumNums[sumNumsIndex] = nums2[nIndex];

                sumNumsIndex++;
                nIndex++;
                n--;
            }else {
                sumNums[sumNumsIndex] = nums1[mIndex];

                sumNumsIndex++;
                mIndex++;
                m--;
            }
        }

        if (m == 0 && nums2[nIndex] != 0){
            while (n != 0){
                sumNums[sumNumsIndex] = nums2[nIndex];

                sumNumsIndex++;
                nIndex++;
                n--;
            }

        }else if (n == 0 && nums1[mIndex] != 0) {

            while (m != 0){
                sumNums[sumNumsIndex] = nums1[mIndex];

                sumNumsIndex++;
                mIndex++;
                m--;
            }

        }
    }
}
*/


import java.text.DecimalFormat;

class Solution {
    /*public void merge(int[] nums1, int m, int[] nums2, int n) {
        int[] sorted = new int[m + n];
        int p1 = 0;
        int p2 = 0;
        int tmp = 0;

        while (p1 != m || p2 != n){
            if (p1 == m){
                tmp = nums2[p2++];
            } else if (p2 == n){
                tmp = nums1[p1++];
            } else if (nums1[p1] < nums2[p2]){
                tmp = nums1[p1++];
            } else if (nums2[p2] <= nums1[p1]){
                tmp = nums2[p2++];
            }

            sorted[p1 + p2 - 1] = tmp;
        }
    }*/


}